
/**
 * index
 */
 define(function (require) {
	var $ = require('jquery');
	var base = require('base');
	var com = require('./common');
	
	changeLang = function(lang){
		localStorage.setItem("lang", lang);
	}
	if(localStorage.getItem("lang")){
		var Lang = localStorage.getItem("lang")
	}else{
		var Lang = "zh_CN"
	}

	// 中文/英文转换
	if(Lang != "zh_CN"){
		$('#promotional_video').html("Promotional video")
		$('#link_more').html("Learn More +")
		$('#mtzx').html("Media Center")
		$('#Contact_us').html("Contact us:")
		$('#E-Mail').html("E-Mail")
		$('#Reserved').html("All Rights Reserved")
	}





// 第二部分 start
// (function () {

	animate_number = function(){
		//数字滚动效果
		require('animate-number');
		var numberBox = $('.ipart2')//获取父元素
		console.log("numberBox:", numberBox.offset()==null)
		if(numberBox.offset()!=null){
			var	scrollHeight = numberBox.offset().top - $(window).height() + 100;//距文档顶部距离-屏幕高度+自身高度=滚动条滚去这个高度正好出现在屏幕中	

			var _num01 = $('.ipart2 .tit .num.num01 ').text();//获取number1里面的数值
			console.log("_num01:", _num01)
			var _num02 = $('.ipart2 .tit .num.num02 ').text();
			console.log("_num02:", _num02)
			// var _num03 = $('.ipart2 .tit .num.num03 ').text();
			// var _num04 = $('.ipart2 .tit .num.num04 ').text();

			//主变化函数changeGo
			var changeGo = function () {
				if ($(window).scrollTop() - $(window).height() / 4 > scrollHeight) {
					$('.ipart2 .tit .num.num01 ').stop().prop('number', 0).animateNumber({ number: _num01 }, 1000);
					$('.ipart2 .tit .num.num02 ').stop().prop('number', 0).animateNumber({ number: _num02 }, 1000);
					// $('.ipart2 .tit .num.num03 ').stop().prop('number', 0).animateNumber({ number: _num03 }, 1000);
					// $('.ipart2 .tit .num.num04 ').stop().prop('number', 0).animateNumber({ number: _num04 }, 1000);

					$(window).off('scroll', changeGo);//解除事件绑定    
				}
			}
			$(window).on('scroll', changeGo);			
		}
	}



// })();
// 第二部分 end


	addFooter = function(data){
		$('#site_telephone').html(data.site_telephone)
		$('#site_telephone').attr("href", "tel:"+data.site_telephone)

		$('#site_email').html(data.site_email)
		$('#site_email').attr("href", "mailto:"+data.site_emai)

		$('#site_address').html(data.site_address)
		$('#bottom_logo').attr("src", data.bottom_logo)

		$('#copyright').html(data.copyright)
		$('#icp_record_no').html(data.icp_record_no.title)
		$('#icp_record_no').attr("href", data.icp_record_no.link_url)
		$('#branch_company').html(data.branch_company.title)
		$('#branch_company').attr('href', data.branch_company.link_url)
		$('#record_no').html(data.record_no.title)
		$('#record_no').attr("href", data.record_no.link_url)
		$('#record_no_link').attr("href", data.record_no.link_url)

		if(Lang != "zh_CN"){
			let erweima_info = '<div  class="erweima_info"><img src="'+data.weChat_code+'" alt="" >Follow the Wechat Official Account</div>';
			erweima_info += '<div  class="erweima_info"><img src="'+data.tiktok_code+'" alt="" >Follow the Tik Tok</div>';
			$("#erweima").html(erweima_info);
		}else{
			let erweima_info = '<div  class="erweima_info"><img src="'+data.weChat_code+'" alt="" >关注公众号</div>';
			erweima_info += '<div  class="erweima_info"><img src="'+data.tiktok_code+'" alt="" >安力抖音</div>';
			$("#erweima").html(erweima_info);
		}


	}




	// 获取首页产品类别
	$.ajax(seajs.ajaxroot + "getProductCate",{		
		type:'post',
		headers:{
			'locale-language':Lang
		},
		success:function(res){
			console.log('getProductCate', res)
			let data = res.data;
			$("#cn_title").html(data.energy_storage_product.title)
			$("#cn_img").attr("src",data.energy_storage_product.image)
			$("#bd_title").html(data.backup_product.title)
			$("#bd_img").attr("src",data.backup_product.image)
		}
	})


	// 
	$.ajax(seajs.ajaxroot + "getConfig",{		
		type:'post',		
		ajax:false,
		headers:{
			'locale-language':Lang
		},
		success:function(res){
			console.log("getConfig:", res)
			let data = res.data;
			let about_us = res.data.about_us;
			$('#about_us_title').html(about_us.title)
			$('#about_us_img').attr('src',about_us.image);
			$('#about_us_content').html(about_us.description)

			// param
			let params = '';
			about_us.params.forEach((item, index)=>{				
				if(item.params_unit == null || item.params_unit == ""){
					params += '<li class="item"><div class="tit"><span class="num">'+item.params_value+'</span></div> ';
					params += '<div class="con con15">'+item.params_title+'</div> </li>';
				}else{
					params += '<li class="item item0'+(index+1)+'"><div class="tit">';
					params += '<span class="num num0'+(index+1)+'">'+item.params_value+'</span>';
					params += '<span class="unit">'+item.params_unit+'</span></div> ';
					params += '<div class="con con15">'+item.params_title+'</div> </li>';	
				}
			})
			$('#about_us_param').html(params)
			animate_number();
			$('#play_btn').attr('data-v',data.about_us.video_src)

			// footer
			addFooter(data)


		}
	})


	showDown = function(obj){
		$(obj).children(".madd_ul").css("display", "block")
		// $(obj).addClass('cur').siblings().removeClass('cur');
		$(obj).siblings().find(".madd_ul").css("display", "none")
	}


	// 获取顶部导航
	$.ajax(seajs.ajaxroot + "getNav",{		
		type:'post',
		data:{type:1},
		headers:{
			'locale-language':Lang
		},
		success:function(res){	
			console.log('getNav:', res)
			if(res.code == 200){
				let navList = '';
				let mNavList = '';
				res.data.forEach((item,index)=>{		
					if(item.children.length > 0){
						navList += '<li class="inav_li inav_li1 "> <a href="'+item.external_link_url+'" target="" class="nav_a" >'+item.title+'</a>'; 
							
							let add_ul_list = '<ul class="add_ul">';
							item.children.forEach(child=>{
								add_ul_list += '<li class=""><a href='+child.external_link_url+' >'+child.title+'</a></li>';
									
							})
							add_ul_list += '</ul>';

						navList += add_ul_list;
						navList += '</li>' ;
					}else{
						navList += '<li class="inav_li inav_li1 "> <a href="'+item.external_link_url+'" target="" class="nav_a">'+item.title+'</a> </li>' ;
					}
					

					if(item.children.length > 0){
						mNavList += '<li class="mnav_li mnav_li1" onclick="showDown(this)"> <a href="'+item.external_link_url+'" class="mnav_a" >'+item.title+'</a> <i></i> ';
							
						let madd_ul_list = '<ul class="madd_ul">';
						item.children.forEach(child=>{
							madd_ul_list += '<li class=""><a href='+child.external_link_url+' >'+child.title+'</a></li>';								
						})
						madd_ul_list += '</ul>';

						mNavList += madd_ul_list;
						mNavList += '</li>' ;
					}else{
						mNavList += '<li class="mnav_li mnav_li1"> <a href="'+item.external_link_url+'" class="mnav_a">'+item.title+'</a> </li> ' ;
					}

					
				})
				$('#topNav').html(navList);
				$('#mTopNav').html(mNavList);
			}

			// 获取屏幕宽度
			console.log("width:", $(window).width())
			if($(window).width() <= 780){
				let header_height = $(".header").height()
				console.log("height:",$(".header").height() )
				$('.ibanner').css("margin-top", header_height)
			}

		},
		error:function(err){
			console.log("error:", err)
		}

	});


	let iheader_height = $('.iheader').height();
	console.log("iheader_height:", iheader_height);
	$('.seat').css("height",iheader_height)




	// $("#mTopNav .mnav_li").click(function(){
	// 	console.log($(this).children(".madd_ul"))
	// 	$(this).children(".madd_ul").css("display", "block")
	// 	// $(this).addClass('cur').siblings().removeClass('cur');
	// 	$(this).siblings().find(".madd_ul").css("display", "none")
	// })





	// 获取banner'
	$.ajax(seajs.ajaxroot + "getBanner", {
		type: 'post',
		data:{nav_id:1},
		ajax:false,
		headers:{
			'locale-language':Lang,
			
		},
		success:function(res){
			console.log('banner:', res)
			let bannerList = '';
			res.data.forEach(item=>{
				bannerList += '<div class="swiper-slide " >';
				bannerList += '<div class="img_box"><img src="'+item.img_src+'" /></div> ';
				bannerList += '<div class="intro_box">';
				bannerList += '<div class="wrap">';
				bannerList += '<div class="tit" style="line-height:1.2"><em >'+item.title+'</em></div>';
				bannerList += '<div class="con" style="margin-top:8px">'+item.description+'</div> ';
				bannerList += '<div class="icon"><img src="/cn/resources/web/img/ibanner_circle.png"  /></div>';
				bannerList += '</div></div></div>';				   
			})
			$('#top_banner').html(bannerList)

		}
	})









	// if(typeof(module) == "undefined" || module == null || module != "anli"){
		// 导航滚动和

		// 初始化logo和查找及语言icon
		if(module == undefined || module != "index"){
			$('#anli_logo').attr("src","/cn/resources/web/images/new_hover_logo.png")
			$('.header .header_top .h_tools .h_language .icon').css({"background":"url(/cn/resources/web/images/net.png) no-repeat center/contain"})				
			$('.newsearch').css({"background":"url(/cn/resources/web/images/newsearch.png) no-repeat center/contain"})			
		}

		$(window).off('scroll.xc_nav');
		$(window).on('scroll.index_nav', function () {
			if ($(window).scrollTop() > 30) {
				$('.header').addClass('on');
				$('.header .header_top .inav_wrapper .inav_li .nav_down').hide();
				$('#anli_logo').attr("src","/cn/resources/web/images/new_hover_logo.png")
				$('.header .header_top .h_tools .h_language .icon').css({"background":"url(/cn/resources/web/images/net.png) no-repeat center/contain"})				
				$('.header .header_top .h_tools').css({"color":"#000"})				
				$('.newsearch').css({"background":"url(/cn/resources/web/images/newsearch.png) no-repeat center/contain"})
				$('.header .header_top .bg').hide();
			} else {
				if ($('.lnb').hasClass('on')) {

				} else {
					$('.header').removeClass('on');
					$('.header .header_top .h_tools .h_language .icon').removeAttr('style')
					$('.header .header_top .h_tools').removeAttr('style')
					$('.newsearch').removeAttr("style")
					if(module != null && module == "index"){
						$('#anli_logo').attr("src","/cn/resources/web/images/new_logo.png")
					}else{
						$('#anli_logo').attr("src","/cn/resources/web/images/new_hover_logo.png")
						$('.header .header_top .h_tools .h_language .icon').css({"background":"url(/cn/resources/web/images/net.png) no-repeat center/contain"})				
						$('.newsearch').css({"background":"url(/cn/resources/web/images/newsearch.png) no-repeat center/contain"})
					}
					
				}
			}
		});		
	// }


	// Banner start
	(function () {
		//  Banner适应窗口大小
		bannerResize = function () {
			if (base.getType() != 'Mobile') { 
				// 首页banner
				var winH = $(window).outerHeight();
				var winW = $(window).outerWidth();
				var imgscale = winW / (winH)

				// $('.ibanner').width(winW);
				$('.ibanner').height(winH);
				$('.ibanner .swiper-container').height(winH);

				if(module == "anli"){
					$('.ibanner').height('auto');
				}

				//$('.ibanner .swiper img').height(winH);
			} else {
				$('.ibanner').height(0);
				$('.ibanner .swiper-container').css('height','auto');
			}
		}

		bannerResize();
		$(window).on('resize', bannerResize);

		// 根据实际slide数量创建左侧分页器
		$('.ibanner .swiper-slide').each(function () {
			$('.ibanner .left-area .pagination-left').append('<div class="line"></div>');
		});

		// 初始化swiper
		var slideTimer = 20000;
		var bannerSwiper = new Swiper('.ibanner .swiper-container', {
			speed: 1000,
			loop: true,
			// effect:'fade',
			simulateTouch: false, //禁用鼠标拖动，触摸正常
			autoplay: {
				delay: slideTimer,
				waitForTransition: false,
				disableOnInteraction: false
			},
			observer: true,//修改swiper自己或子元素时，自动初始化swiper
			observeParents: true,//修改swiper的父元素时，自动初始化swiper
			watchSlidesProgress: true,
			virtualTranslate: true, // 禁用自动translate
			pagination: {
				el: '.swiper-pagination.pagination-bott',
				clickable: true,
				renderBullet: function (index, className) {
					return '<div class="bullet_outer ' + className + '"><div class="tit">' + $('.ibanner .swiper-container .swiper-slide').eq(index + 1).attr('data-page') + '</div> <span class="timer"><span class="process"></span></span> </div>';
				}
			},
			navigation: {
				nextEl: '#banner_next',
				prevEl: '#banner_pre',
			},
			on: {
				init: function () {
					$('.ibanner .left-area .pagination-left .line').eq(this.activeIndex - 1).addClass('active').siblings().removeClass('active');
				},
				// 手动设置translate，让slide重叠（来自fadeEffect源码）
				// https://github.com/nolimits4web/swiper/blob/v4.5.3/src/components/effect-fade/effect-fade.js
				setTranslate: function () {
					var swiper = this;
					var slides = swiper.slides;
					for (var i = 0; i < slides.length; i += 1) {
						var $slideEl = swiper.slides.eq(i);
						var offset = $slideEl[0].swiperSlideOffset;
						var tx = -offset;
						if (!swiper.params.virtualTranslate) tx -= swiper.translate;
						var ty = 0;
						if (!swiper.isHorizontal()) {
							ty = tx;
							tx = 0;
						}
						$($slideEl).css('transform', 'translate(' + tx + 'px, ' + ty + 'px)');
					}
				},
				setTransition:function(duration) {
					var swiper = this;
					var slides = swiper.slides;
					var $wrapperEl = swiper.$wrapperEl;
					slides.transition(duration);
					if (swiper.params.virtualTranslate && duration !== 0) {
						var eventTriggered = false;
						slides.transitionEnd(function(){
							if (eventTriggered) return;
							if (!swiper || swiper.destroyed) return;
							eventTriggered = true;
							swiper.animating = false;
							var triggerEvents = ['webkitTransitionEnd', 'transitionend'];
							for (var i = 0; i < triggerEvents.length; i += 1) {
								$wrapperEl.trigger(triggerEvents[i]);
							}
						});
					}
				},
				slideChange: function () {
					$('.ibanner .swiper-pagination-bullet').removeClass('play');
					$('.ibanner .swiper-pagination-bullet-active').addClass('play');
					$('.ibanner .left-area .pagination-left .line').eq(this.activeIndex - 1).addClass('active').siblings().removeClass('active');
				},
				slideChangeTransitionStart: function () {
					var nextSlide = this.slides.eq(this.activeIndex);
					gsap.set(nextSlide.find('.img_box img'), { scale: 1 });
					gsap.set(nextSlide.find('.intro_box .tit'), { x: 0, autoAlpha: 1 });
					gsap.set(nextSlide.find('.intro_box .con'), { x: 0, autoAlpha: 1 });
					gsap.set(nextSlide.find('.intro_box .icon'), { width: 34, autoAlpha: 1 });
					gsap.from(nextSlide.find('.img_box img'), 15, { scale: 1.3, ease: Power2.easeOut });
					gsap.from(nextSlide.find('.intro_box .tit'), 2, { x: -50, autoAlpha: 0, ease: Power4.easeOut, delay: 0.5 });
					gsap.from(nextSlide.find('.intro_box .con'), 2, { x: -50, autoAlpha: 0, ease: Power4.easeOut, delay: 0.8 });
					gsap.from(nextSlide.find('.intro_box .icon'), 2, { width: 0, autoAlpha: 0, ease: Power4.easeOut, delay: 1 });

					var prevSlide = this.slides.eq(this.previousIndex);
					gsap.set(prevSlide.find('.intro_box .tit'), { x: 0, autoAlpha: 1 });
					gsap.set(prevSlide.find('.intro_box .con'), { x: 0, autoAlpha: 1 });
					gsap.set(prevSlide.find('.intro_box .icon'), { width: 34, autoAlpha: 1 });
					//gsap.to(prevSlide.find('.img_box img'), 15, {scale: 1.3, ease: Power2.easeOut});
					gsap.to(prevSlide.find('.intro_box .tit'), 0, { x: -150, autoAlpha: 0, ease: Power4.easeOut });
					gsap.to(prevSlide.find('.intro_box .con'), 0, { x: -150, autoAlpha: 0, ease: Power4.easeOut, delay: 0.3 });
					gsap.to(prevSlide.find('.intro_box .icon'), 0, { width: 0, autoAlpha: 0, ease: Power4.easeOut, delay: 0.6 });
				},

				// slideChangeTransitionStart: function(){
				// 	var vid = $(this.slides[this.activeIndex]).find('video');
				// 	if(vid.length > 0) {
				// 		var video = vid.get(0);
				// 		video.currentTime = 0;
				// 		this.autoplay.stop();

				// 	}
				// }
			}
		});


		$(function () {
			$('.ibanner .process').css({ "transition-duration": slideTimer + 'ms' });
			$('.ibanner .swiper-pagination-bullet-active').addClass('play');
			$('.ibanner .btn-play').on('click', function () {
				bannerSwiper.autoplay.start();
				$('.ibanner .swiper-pagination-bullet.play').removeClass('stop');
				$('.ibanner .btn-stop').show();
				$(this).hide();
			});
			$('.ibanner .btn-stop').on('click', function () {
				bannerSwiper.autoplay.stop();
				$('.ibanner .swiper-pagination-bullet.play').addClass('stop');
				$('.ibanner .btn-play').show();
				$(this).hide();
			});
			$('.ibanner .left-area .pagination-left .line').on('click', function () {
				bannerSwiper.slideTo($(this).index() + 1);
			});
		});
	})();
	// Banner end

	// 第一部分 start
	// 手风琴效果
	(function () {
		function sfq() {
			if (base.getType() != 'Mobile') {
				$('.ipart1 .item').height('100%');
				$('.ipart1 .item').off('click.sfqm');

				// 鼠标移入效果
				$('.ipart1 .item').on('mouseenter.sfqpc', function () {
					var $this = $(this);
					$this.addClass('on').siblings().removeClass('on');
				});

				var $item = $('.ipart1 .item.on').length > 0 ? $('.ipart1 .item.on').eq(0) : $('.ipart1 .item').eq(0);
				var trans = $item.css('transition');
				$item.css('transition', 'none').addClass('on').siblings();

				// 设置图片容器宽度
				function setImgWidth() {
					$('.ipart1 .item .img_box .img_cover').width('100%');
					$('.ipart1 .item .img_box .img_full').width('100%');
					$('.ipart1 .item .img_box .img_cover').width($('.ipart1 .item:not(.on) .img_box .img_cover').eq(0).width());
					$('.ipart1 .item .img_box .img_full').width($('.ipart1 .item.on .img_box .img_full').eq(0).width());
				}

				//$(window).on('resize', setImgWidth);

				setImgWidth();
				$item.css('transition', trans);
			} else {
				$('.ipart1 .item').off('mouseenter.sfqpc');
				$('.ipart1 .item').removeClass('on');

				$('.ipart1 .item .img_box .img_cover').width('100%');
				$('.ipart1 .item .img_box .img_full').width('100%');
				var coverHeight = $('.ipart1 .item .img_box .img_cover img').height();
				var fullHeight = $('.ipart1 .item .img_box .img_full img').height();
				$('.ipart1 .item').height(coverHeight);
				$('.ipart1 .item.on').height(fullHeight);
				$('.ipart1 .item').on('click.sfqm', function () {
					var $this = $(this);
					window.location.href = $this.find('.txt_box .tit a').attr('href');
				});
			}
		}
		sfq();
		$(window).on('resize', sfq);
	})();

	// 第一部分 end




	(function(){

		// 视频弹窗
		require('box');
		require('video');
		videoJs();
		function videoJs() {
			console.log("videoJs")
			// 变量定义
			var video_width, video_height;

			// 屏幕类型改变后执行的代码
			$('body').on("screenChanged", function () {
				multiScreenJs(base.getType());
			});
			multiScreenJs(base.getType());
			function multiScreenJs(tempType) {
				if (tempType == 'Pc') {
					// 56.25%
					video_width = 960;
					video_height = 540;
				} else if (tempType == "Pad" || tempType == "Padp") {
					video_width = 760;
					video_height = 427;
				} else {
					video_width = '100%';
					video_height = 300;
				}
			}
			// 屏幕类型改变后执行的代码 end

			var videoControl;
			if (base.browser.ie > 8 || base.browser.ie == 0) {
				videoControl = true
			} else {
				videoControl = false
			}
			$("#play_btn").on('click', function () {		
					
				if ($.trim($(this).data('v'))) {
					//e.preventDefault();
					var tmp = $(this).data('v');
					var videoId = 'video' + Math.floor(Math.random() * 100000);
					if (tmp.indexOf(".mp4") != -1) {
						//console.log('本地视频')
						// 本地视频dom
						var _dom = '<a id="about-close" class="about-video-close" '
							+ 'style="position: absolute;  display: block; z-index: 5; cursor: pointer;">'
							+ '<i>CLOSE</i>'
							+ '</a>'
							+ '<video id=' + videoId + ' class="video-js vjs-default-skin" oncontextmenu="return false;" loop>'
							+ '<source src=' + tmp + ' type="video/mp4">'
							+ '</video>';

						var player;
						$.box(_dom, {
							width: video_width != '100%' ? video_width : $(window).width(),
							height: video_height + 40,
							hook: 'i_video_box',
							layout: false,
							// 本地视频回调
							onshow: function () {
								player = videojs(videoId, {
									width: video_width != '100%' ? video_width : $(window).width(),
									height: video_height,
									poster: '',
									controls: videoControl,
									autoplay: true,
									preload: 'auto',
									bar: false
								});
								$('.vjs-big-play-button').trigger('click');
								$('.i_video_box').find('#about-close').click(function () {
									$.box.hide();
								})
							}
						});

					} else {
						//console.log('第三方视频')
						// 第三方视频dom
						var _dom = '<a id="about-close" class="about-video-close" '
							+ 'style="position: absolute; display: block; z-index: 5; cursor: pointer;">'
							+ '<i>CLOSE</i>'
							+ '</a>'
							+ '<iframe height="100%" width="100%" frameborder="0" allowfullscreen="true"'
							+ ' src="' + tmp + '"></iframe>';

						var player;
						$.box(_dom, {
							width: video_width != '100%' ? video_width : $(window).width(),
							height: video_height + 40,
							hook: 'i_video_box',
							layout: false,

							// 第三方视频回调
							onshow: function () {
								$('.i_video_box').find('#about-close').click(function () {
									$.box.hide();
								})
							}
						});
					}
				}
			});
		}

	})()





	
	// $.post(seajs.ajaxroot + "/ext/ajax_index.jsp", { flag: "newsType" }, function (data) {
		// $('#newsType').html(data);
		$('.ipart4 .infor .right .tab').click(function () {
			var newsCat = $(this).data('id');
			$(this).addClass('cur').siblings().removeClass('cur');
			$.post(seajs.ajaxroot + "/ext/ajax_index.jsp", { flag: "news", catId: newsCat }, function (data2) {
				// console.log("data2:",data2)
				// $('#index_news').html(data2);
				/* 第四部分 start */
				// (function () {
				// 	var newsSwiper;
				// 	function swiperRes() {
				// 		if (base.getType() != 'Mobile') {
				// 			if (!newsSwiper) {
				// 				newsSwiper = new Swiper(".ipart4 .content .swiper-container", {
				// 					autoplay: true,
				// 					slidesPerView: 3,
				// 					speed: 800,
				// 					spaceBetween: '2.5%',
				// 					pagination: {
				// 						el: '.ipart4 .content .swiper-container .swiper-pagination',
				// 						type: 'progressbar'
				// 					},
				// 					navigation: {
				// 						nextEl: '.ipart4 .content .swiper-container .swiper-button-next',
				// 						prevEl: '.ipart4 .content .swiper-container .swiper-button-prev',
				// 					}
				// 				});
				// 			}
				// 		} else {
				// 			if (newsSwiper) {
				// 				newsSwiper.destroy(true, true);
				// 				newsSwiper = null;
				// 			}
				// 		}
				// 	}
				// 	$(window).on('resize', swiperRes);
				// 	swiperRes();
				// })();
				/* 第四部分 end */

				/* 第五部分 start */
				(function () {





					// logo演绎
					/*
					require('gsap/gsap');
					require('gsap/scrolltrigger');
					gsap.registerPlugin(ScrollTrigger);

					gsap.set('.ipart5 .overlay .img_logo', { scale: 4 });

					function logoRes() {
						var tl;
						if (base.getType() != 'Mobile') {
							if (!tl) {
								tl = gsap.timeline({
									scrollTrigger: {
										trigger: '.ipart5',
										pin: true,
										start: 'top top',
										end: '+=180%',
										scrub: 1
									}
								});
								tl.to({}, { duration: 0.8 })
									.to('.ipart5 .overlay .img_logo', {
										duration: 1,
										scale: 1,
										ease: 'power1.in',
										onStart: function () {
											gsap.to('.ipart5 .overlay', { duration: 0.5, autoAlpha: 1, ease: 'power1.in' });
											gsap.to('.ipart5 .content .play_overlay', { duration: 0.5, autoAlpha: 0, ease: 'power1.in' });
										},
										onReverseComplete: function () {
											gsap.to('.ipart5 .overlay', { duration: 0.5, autoAlpha: 0, ease: 'power1.in' });
											gsap.to('.ipart5 .content .play_overlay', { duration: 0.5, autoAlpha: 1, ease: 'power1.in' });
										},
									})
									.to({}, { duration: 0.8 });
							}
						} else {
							if (tl) {
								tl.scrollTrigger.kill();
								tl.kill();
							}
						}
					}
					$(window).on('resize', logoRes);
					logoRes();
					*/

				})();



				/* 第五部分 end */
			})
		}).eq(0).trigger('click');

	// });


	// 获取首页新闻媒体文章
	$.ajax(seajs.ajaxroot + "getHomeArticle",{		
		type:'post',
		ajax:false,
		headers:{
			'locale-language':Lang
		},
		success:function(res){	
			console.log('getHomeArticle:', res)

			let htmlData = '<div class="swiper-container"><div class="swiper-wrapper">';
			res.data.forEach((item, index)=>{
				htmlData += '<div class="swiper-slide"><div class="item imgZoom">';
				htmlData += '<a href="/detail.html?id='+item.id+'"> <div class="time">'+item.date+'</div><div class="tit tit24">'+item.title+'</div><div class="con con15">'+item.description+'</div>  </a>';
				htmlData += '<div class="img_box"><a> <img src='+item.main_img+' />  </a></div>';
				htmlData += '</div></div>';
			})
			htmlData += '</div></div>';
		
			$('#mtzx_content').html(htmlData);
			
			// 我的自定义swaper
			(function () {
				let myNewsSwiper;
				function swiperRes() {
					if (base.getType() != 'Mobile') {
						if (!myNewsSwiper) {
							myNewsSwiper = new Swiper(".ipart13 .content .swiper-container", {
								autoplay: true,
								slidesPerView: 3,
								speed: 800,
								spaceBetween: '2.5%',
								observer: true,//修改swiper自己或子元素时，自动初始化swiper
								observeParents: true,//修改swiper的父元素时，自动初始化swiper
								pagination: {
									el: '.ipart13 .content .swiper-container .swiper-pagination',
									type: 'progressbar'
								},
								navigation: {
									nextEl: '#next',
									prevEl: '#pre',
								}
							});
						}
					} else {
						if (myNewsSwiper) {
							myNewsSwiper.destroy(true, true);
							myNewsSwiper = null;
						}
					}
				}
				$(window).on('resize', swiperRes);
				swiperRes();
			})();
		},


	});













	// 出场动画定义
	if (base.getType() == "Pc") {
		var vision = base.browser.ie;
		if (vision == 0 || vision > 9) {
			require('scrollreveal')
			window.sr = ScrollReveal();
			var left = { distance: '60px', duration: 1000, origin: 'left', easing: 'ease', scale: 1, opacity: 0 };
			var right = { distance: '60px', duration: 1000, origin: 'right', easing: 'ease', scale: 1, opacity: 0 };
			var bottom = { distance: '60px', duration: 1000, origin: 'bottom', easing: 'ease', scale: 1, opacity: 0, delay: 200 }; //reset: true
			var bottom01 = { distance: '60px', duration: 900, origin: 'bottom', easing: 'ease', scale: 1, opacity: 0, delay: 100 };
			var left01 = { distance: '60px', duration: 1000, origin: 'left', easing: 'ease', scale: 1, opacity: 0, delay: 200 };
			var right01 = { distance: '60px', duration: 1000, origin: 'right', easing: 'ease', scale: 1, opacity: 0, delay: 200 };

			sr.reveal('.ipart1 .item', bottom, 300);
			sr.reveal('.ipart2 .item', bottom, 300);
			sr.reveal('.ipart11 .item', bottom, 300);
			sr.reveal('.ipart3 .intro .txt', left);
			sr.reveal('.ipart3 .intro .tit', left);
			sr.reveal('.ipart3 .intro .con', left);
			sr.reveal('.ipart3 .intro .btns', left);
			sr.reveal('.ipart4 .infor .left .txt', left);
			sr.reveal('.ipart4 .infor .left .tit', left);
			sr.reveal('.ipart4 .infor .right .tab', bottom);
			sr.reveal('.ipart4 .content', bottom);
		}
	}


	$('.header .header_top .h_tools .h_company').click(function () {
		if ($('.lnb').hasClass('on')) {
			$('.header').addClass('on')
		}
	})
	$('.lnb .lnb_inner .btn_lnb_close').click(function () {
		if ($(window).scrollTop() < 90) {
			$('.header').removeClass('on')
		}
	})

	//视差滚动
	require('parallax');
	if(base.getType()=='Pc'){
		$('.ipart3').parallax('50%','-0.3');
	}



	// $("#mTopNav .mnav_li").click(function(){
	// 	console.log($(this).children(".madd_ul"))
	// 	$(this).children(".madd_ul").css("display", "block")
	// 	// $(this).addClass('cur').siblings().removeClass('cur');
	// 	$(this).siblings().find(".madd_ul").css("display", "none")
	// })
  


})